import { ref } from 'vue'

export default function ({ xDataLength, startValue, endValue }) {
  const min = (1 / xDataLength / 2) * 100
  const max = 100 - min

  const hasLeft = ref(startValue > 0)
  const hasRight = ref(endValue < xDataLength - 1)

  function changeZoom(zoomStart, zoomEnd) {
    hasLeft.value = zoomStart > min
    hasRight.value = zoomEnd < max
  }

  return {
    hasLeft,
    hasRight,
    changeZoom,
  }
}
